var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');

var User = mongoose.model('User', { name: String,'password':String });


function Post(username, post, time) {
	this.user = username;
	this.post = post;
	if (time) {
		this.time = time;
	} else {
		this.time = new Date();
	}
};
module.exports = Post;

Post.prototype.save = function save(user) {
	// 存入 Mongodb 的文档
	var user = new User(user);
	user.save(function (err) {
 	 if (err) // ...
 		 console.log('meow');
	});
}